cmake_minimum_required(VERSION 3.0)
project(work_ease)

set(CMAKE_CXX_STANDARD 17)
option(BUILD_UNIT_TESTS "Build the unit tests" ON)
option(BUILD_SAMPLES "Build the samples" ON)

message(STATUS "BUILD_UNIT_TESTS:${BUILD_UNIT_TESTS}")
message(STATUS "BUILD_SAMPLES:${BUILD_SAMPLES}")

include_directories(3rdparty/BehaviorTree.CPP/include)
include_directories(include)
link_directories(3rdparty/libs)

aux_source_directory(utils/thread DIR_UTILS_THREAD)
aux_source_directory(utils/utils DIR_UTILS_UTILS)
aux_source_directory(src/policy DIR_POLICY)
aux_source_directory(src/policy/behavior_tree DIR_BEHAVIOR_POLICY)
aux_source_directory(src/task/ DIR_TASK_CPP)
aux_source_directory(src/task/behavior_tree_cpp DIR_BEHAVIOR_TREE_CPP)
aux_source_directory(src/scheduler DIR_SCHEDULER_CPP)
aux_source_directory(src/exclude DIR_EXCLUDE_CPP)
aux_source_directory(src/logger DIR_LOGGER_CPP)
aux_source_directory(src/scripting DIR_SCRIPTING_CPP)
aux_source_directory(src/types DIR_TYPE_TRAITS_CPP)

add_library(${PROJECT_NAME} SHARED
    ${DIR_TASK_CPP} ${DIR_UTILS_THREAD} ${DIR_UTILS_UTILS} ${DIR_POLICY} ${DIR_BEHAVIOR_POLICY} ${DIR_BEHAVIOR_TREE_CPP} ${DIR_SCHEDULER_CPP}
    ${DIR_LOGGER_CPP} ${DIR_EXCLUDE_CPP} ${DIR_SCRIPTING_CPP} ${DIR_TYPE_TRAITS_CPP}
)
target_link_libraries(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/3rdparty/libs/libbehaviortree_cpp_v3.a pthread)

if (BUILD_UNIT_TESTS)
  add_subdirectory(tests)
endif ()

if (BUILD_SAMPLES)
  add_subdirectory(sample)
endif ()
